#ifndef DEJKSTRAALGORITHM_H_
#define DEJKSTRAALGORITHM_H_

#include "IGraphAlgorithm.h"

#include "graph_support/impls/vector/VectorGraph.h"

#include "graph_support/alg/shortest_path/Dejkstra.h"

namespace native_orbitor
{

template< typename GraphT >
class DejkstraAlgorithm: public IGraphAlgorithm
{
public:
	DejkstraAlgorithm( size_t startVertId )
		: startVertId( startVertId )
	{
	}

private:
	typedef GraphT Graph;
//	typedef GRAPH_SUPPORT_NS::impls::vector::VectorGraphTmpl< int > Graph;

public:
	virtual bool isApplicable2graph( GRAPH_SUPPORT_NS::Graph * abstractGraphPtr )
	{
		Graph * graphPtr = dynamic_cast< Graph * >( abstractGraphPtr );
		return graphPtr != NULL;
	}

	virtual void runOnGraph( GRAPH_SUPPORT_NS::Graph * abstractGraphPtr )
	{
		using namespace GRAPH_SUPPORT_NS::alg::shortest_path;

		Graph * graphPtr = dynamic_cast< Graph * >( abstractGraphPtr );
		assert( graphPtr );
		Graph & graph = * graphPtr;

		Dejkstra< Graph > dejkstra( graph );
		dejkstra( graph.num2vert( startVertId ) );
	}

private:
	size_t startVertId;
};

}

#endif /* DEJKSTRAALGORITHM_H_ */
